﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<Cs2102BookingSystem.Models.HOTEL_ROOM_INFO>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	AdvancedSearch
</asp:Content>
<script runat="server">
    
    int _submitted = 0;
    public void Page_Load()
    {
        _submitted = Int32.Parse(ViewData["submitted"].ToString()); ;
        if (_submitted == 1)
        {
            ResultPanel.Visible = true;
        }
        else
        {
            ResultPanel.Visible = false;
        }
    }

    

</script>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <h2>Advanced Search</h2>

    <% using (Html.BeginForm()) {%>
        <%: Html.ValidationSummary(true) %>
        
           <fieldset>
             <div class="editor-label">
                
             <table>
             <tr>
                <th style="width:10px">
                    <td style="width: 20px">Country:</td>
                    <td>
                    <%: Html.DropDownListFor(model => model.COUNTRY, (SelectList)ViewData["countrylist"], "-- Select One --", new Dictionary<string, object> { { "id", "COUNTRY" }, { "runat", "server" }, { "AutoPostBack", "true" }, { "onchange", "this.form.submit()" } })%>
                    </td>
                    <td colspan=2 style=" width: 30px" >
                    <%: Html.ValidationMessageFor(model => model.COUNTRY) %>
                    </td>
                </th>
                <th style="width:10px">
                    <td style="width:20px">Hotel:</td>
                    <td>
                     <%: Html.DropDownListFor(model => model.HOTEL_NAME, (SelectList)ViewData["hotel_list"], "-- Select One --", new Dictionary<string, object> { { "id", "HOTEL_NAME" }, { "runat", "server" }, { "AutoPostBack", "true" }, { "onchange", "this.form.submit()" } })%>
                    </td>
                    <td colspan=2 style=" width: 30px">
                    <%: Html.ValidationMessageFor(model => model.HOTEL_NAME) %>
                    </td>
                </th>
                <th style="width:10px">
                    <td style="width: 20px">Branch:</td>
                    <td>
                     <%: Html.DropDownListFor(model => model.BRANCHNAME, (SelectList)ViewData["branch_list"], "-- Select One --", new Dictionary<string, object> { { "id", "BRANCHNAME" }, { "runat", "server" }, { "AutoPostBack", "true" }, { "onchange", "this.form.submit()" } })%>
                    </td>
                    <td colspan=2 style=" width: 30px">
                    <%: Html.ValidationMessageFor(model => model.BRANCHNAME) %>
                    </td>
                </th>

                <th style="width:10px">
                     <td style="width: 20px; height: 21px">District:</td>
                    <td style="height: 21px">
                     <%: Html.DropDownListFor(model => model.DISTRICT, (SelectList)ViewData["district_list"], "-- Select One --", new Dictionary<string, object> { { "id", "DISTRICT" }, { "runat", "server" }, { "AutoPostBack", "true" }, { "onchange", "this.form.submit()" } })%>
                    </td>
                    <td colspan=2 style="height: 21px ; width: 30px" >
                    <%: Html.ValidationMessageFor(model => model.DISTRICT) %>
                    </td>
                </th>
                </tr>

                <tr>
                
                    <th style="width:10px">
                        <td style="width: 20px">Room Type:</td>
                        <td>
                        <%: Html.DropDownListFor(model => model.ROOMTYPE, (SelectList)ViewData["roomlist"], "-- Select One --", new Dictionary<string, object> { { "id", "ROOMTYPE" }, { "runat", "server" }, { "AutoPostBack", "true" }, { "onchange", "this.form.submit()" } })%>
                        </td>
                        <td colspan=2 style=" width: 30px" >
                        <%: Html.ValidationMessageFor(model => model.ROOMTYPE) %>
                        </td>

                    </th>
                    <th style="width:10px">
                    <td style="width: 20px">Bed Type:</td>
                    <td>
                    <%: Html.DropDownListFor(model => model.BEDTYPE, (SelectList)ViewData["bedlist"], "-- Select One --", new Dictionary<string, object> { { "id", "BEDTYPE" }, { "runat", "server" }, { "AutoPostBack", "true" }, { "onchange", "this.form.submit()" } })%>
                    </td>
                    <td colspan=2 style=" width: 30px" >
                    <%: Html.ValidationMessageFor(model => model.BEDTYPE) %>
                    </td>
                </th>
                    
                
                </tr>
                <th> <p style="margin-left: 59px">
                &nbsp;<input type="submit" name="submit1" value="Search" 
                    style="width: 79px; margin-left: 0px" /></p></th>
            </table>   
            </div>
            
           
        </fieldset>

    <% } %>

    <asp:panel id="ResultPanel" runat="server" visible="false">
         <% Html.RenderAction("AdvancedSearchResult", "Search", new {_country = Model.COUNTRY, 
                                                                    _hotel_name = Model.HOTEL_NAME,
                                                                    _branch= Model.BRANCHNAME, 
                                                                    _district = Model.DISTRICT,
                                                                    _roomType = Model.ROOMTYPE,
                                                                    _bedType = Model.BEDTYPE}); %>
       
    </asp:panel>


    <div>
        <%: Html.ActionLink("Back", "Index", "Home")%>
    </div>

</asp:Content>
